<?php
/**
* @package Admin Tool Kit - Add user
* @id $Id: add_user_functions.php 128 2008-10-17 10:22:27Z ej.frerejean $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
* Get all the groups for the groups dropdown.
*/
function get_groups()
{
	static $option_list = null;
	
	// Only run this once
	if ($option_list == null)
	{
		global $db, $user;
	
		// Just ignore the BOTS and GUESTS groups
		$group_ignore = array('BOTS', 'GUESTS');
		
		// Get the groups and build the dropdown list
		$sql = 'SELECT group_id, group_type, group_name
			FROM ' . GROUPS_TABLE . '
			WHERE ' . $db->sql_in_set('group_name', $group_ignore, true);
		$result = $db->sql_query($sql);
	
		$option_list = '';
		while ($row = $db->sql_fetchrow($result))
		{
			$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
			$option_list .= "<option value='{$row['group_id']}'>{$group_name}</option>";
		}
	
		$db->sql_freeresult($result);
	}
	
	return $option_list;
}
?>